package com.example.team.HotelTitle.Mapper;

import com.example.team.HotelTitle.Entity.TitleEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName:SelectAllMapper
 * Description:
 *
 * @Author: fy.chg
 * @CreateTime:2024/1/14 10:23
 */

@Mapper
public interface TitleMapper {
    // 显示所有数据  /selectAll
    @Select("select id,hotel_name,level,province,local,state,reservation,notes,create_name,create_time from hotel_title")
    public List<TitleEntity> selectAll();
   //显示单个详细数据  /show
    @Select("select hotel_name,level,province,local,state,reservation,notes,create_name,create_time,logo,black_ground from hotel_title where id = #{id}")  //显示单个数据
    TitleEntity show(int id);

    @Insert("Insert into hotel_title(hotel_name,level,province,local,state,reservation,notes,create_name,create_time,logo,black_ground,manger_account,manger_pwd) values (#{hotelName},#{level},#{province},#{local},#{state},#{reservation},#{notes},#{createName},#{createTime},#{logo},#{blackGround},#{mangerAccount},#{mangerPwd})")
    int add(TitleEntity titleEntity);

    @Select("select hotel_name,level,province,local,state,reservation,notes,create_name,create_time from hotel_title where state = #{state} and reservation = #{reservation}")
    List<TitleEntity> selectByState(TitleEntity titleEntity);
}
